package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkPromoUpload;
import com.htgd.gardenexpo.dao.GeConParkPromoUploadDao;
import com.htgd.gardenexpo.service.GeConParkPromoUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkPromoUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 14:15:03
 */
@Service("geConParkPromoUploadService")
public class GeConParkPromoUploadServiceImpl implements GeConParkPromoUploadService {
    @Resource
    private GeConParkPromoUploadDao geConParkPromoUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConParkPromoUpload queryById(Integer id) {
        return this.geConParkPromoUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkPromoUpload> queryAllByLimit(int offset, int limit) {
        return this.geConParkPromoUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkPromoUpload> queryByPromoId(int id) {
        return this.geConParkPromoUploadDao.queryByPromoId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkPromoUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPromoUpload insert(GeConParkPromoUpload geConParkPromoUpload) {
        this.geConParkPromoUploadDao.insert(geConParkPromoUpload);
        return geConParkPromoUpload;
    }

    /**
     * 修改数据
     *
     * @param geConParkPromoUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPromoUpload update(GeConParkPromoUpload geConParkPromoUpload) {
        this.geConParkPromoUploadDao.update(geConParkPromoUpload);
        return this.queryById(geConParkPromoUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConParkPromoUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByPromoId(Integer id) {
        return this.geConParkPromoUploadDao.deleteByPromoId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int pid) {
        return this.geConParkPromoUploadDao.deleteByIds(id,pid) > 0;
    }
}
